package com.tongcao.cn.oauth.executor;

import com.tongcao.cn.dfire.result.Result;
import com.tongcao.cn.dfire.utils.ResultUtil;
import com.tongcao.cn.oauth.handler.ThirdPartyHandler;
import com.tongcao.cn.oauth.request.BaiduJumpRequest;
import com.tongcao.cn.oauth.request.TencentJumpRequest;
import com.tongcao.cn.oauth.vo.PersonVO;
import org.springframework.stereotype.Component;

/**
 * @author:tongcao
 * @since:2019/11/22 15:49
 * Description:
 */
@Component
public class TencentJumpExecutor extends AbstractJumpExecutor<TencentJumpRequest, String> {

    @Override
    public Result execute(TencentJumpRequest request) {
        final String code = request.getCode();
        final ThirdPartyHandler handler = getHandler(code);

        if (null == handler) {
            return ResultUtil.failResult("404", "TencentJumpExecutor获取handler失败");
        }
        final PersonVO personVO = handler.getPersonVO();
        return ResultUtil.successResult(personVO);
    }

}